
#include "Actor/BaseEntity.h"
#include "Actor/ComponentTypeEnum.h"
#include "Actor/Components/Transform2DComponent.h"
#include "BoidRenderComponent.h"
#include "Core/Base.h"
#include "Core/Game.h"
#include "Framework/2D/SpriteRenderer.h"
#include "Framework/2D/SpriteTypes.h"
#include "Framework/Assets/AssetManager.h"
#include "Maths/Matrix4.h"
#include "Resources/ResourceManager.h"
#include "Utilities/Color.h"
#include "Utilities/EventHandler/EventHandler.h"
#include "Utilities/StringUtils.h"
#include "Config/Assert.h"


#include <string>

using namespace CasaEngine;


/**
 * 
 */
BoidRenderComponent::BoidRenderComponent(BaseEntity* pEntity_)
	: Component(pEntity_, CUSTOM_COMPONENT + 1),
		m_pSpriteRenderer(NULL),
		m_pTransform(NULL)
{
	
}

/**
 * 
 */
BoidRenderComponent::~BoidRenderComponent()
{

}

/**
 * 
 */
void BoidRenderComponent::Initialize()
{
	//m_pSpriteRenderer = Game::Instance()->GetGameComponent<SpriteRenderer>();
	//CASAENGINE_ASSERT(m_pSpriteRenderer != NULL && "BoidRenderComponent::Initialize() can't find the component SpriteRenderer");

	m_pTransform = GetEntity()->GetComponentMgr()->GetComponent<Transform2DComponent>();
	CASAENGINE_ASSERT(m_pTransform != NULL && "BoidRenderComponent::Initialize() can't find the Transform2DComponent. Please add it before add a BoidRenderComponent");
}

/**
 * 
 */
void BoidRenderComponent::Update(const GameTime& /*gameTime_*/)
{
	/*Matrix4 mat = m_pTransform->GetWorldMatrix();
	Vector3F pos3 = mat.GetTranslation();
	Vector2F pos(pos3.x, pos3.y);

	m_pSpriteRenderer->AddSprite(m_pSprite, 
		pos, m_pTransform->GetRotation(), 
		m_pTransform->GetScale(), m_Color, 
		pos3.z, m_SpriteEffect);*/
}

/**
 * 
 */
void BoidRenderComponent::Render()
{
	
}

/**
 * 
 */
/*void BoidRenderComponent::HandleEvent(const Event* pEvent_)
{

}*/

/**
 * 
 */
void BoidRenderComponent::Write(std::ostream& /*os*/) const
{

}

/**
 * 
 */
void BoidRenderComponent::Read (std::ifstream& /*is*/)
{

}
